<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
	"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
	<head>
		<!--<title>iCal-like Calendar (CSS+jQuery)</title>-->
		<link rel="stylesheet" href="@{'/public/css/master.css'}" type="text/css" media="screen" charset="utf-8" />
<script src="@{'/public/js/jquery-1.3.min.js'}" type="text/javascript"> </script>
<script src="@{'/public/js/coda.js'}" type="text/javascript"> </script>
	</head>
	<body>
	#{if ItemsDate.get(1).size() > 0 ||  ItemsDate.get(2).size() > 0 ||  ItemsDate.get(3).size() > 0 ||
	 	 ItemsDate.get(4).size() > 0 ||  ItemsDate.get(5).size() > 0 ||  ItemsDate.get(6).size() > 0 || 
	 	 ItemsDate.get(7).size() > 0 ||  ItemsDate.get(8).size() > 0 ||  ItemsDate.get(9).size() > 0 || 
	 	 ItemsDate.get(10).size() > 0 ||  ItemsDate.get(11).size() > 0 ||
	 	 ItemsDate.get(12).size() > 0 ||  ItemsDate.get(13).size() > 0 ||  ItemsDate.get(14).size() > 0 ||
	 	 ItemsDate.get(15).size() > 0 ||  ItemsDate.get(16).size() > 0 ||  ItemsDate.get(17).size() > 0 || 
	 	 ItemsDate.get(18).size() > 0 ||  ItemsDate.get(19).size() > 0 ||  ItemsDate.get(20).size() > 0 || 
	 	 ItemsDate.get(21).size() > 0 ||  ItemsDate.get(2).size() > 0 ||
	 	 ItemsDate.get(23).size() > 0 ||  ItemsDate.get(24).size() > 0 ||  ItemsDate.get(25).size() > 0 ||
	 	 ItemsDate.get(26).size() > 0 ||  ItemsDate.get(27).size() > 0 ||  ItemsDate.get(28).size() > 0 || 
	 	 ItemsDate.get(29).size() > 0 ||  ItemsDate.get(30).size() > 0 ||  ItemsDate.get(31).size() > 0 }
	<h4> <a href="@{Plans.createCalendar()}?id=${PId}&planId=${planId}"  >previous month </a> </h4>
		
			<h4> <a href="@{Plans.createCalendar()}?id=${NId}&planId=${planId}" + >next month </a> </h4>
			
		<h1>${Title}</h1>
		<table cellspacing="0">
			<thead>
				<tr>
					<th>Mon</th><th>Tue</th><th>Wed</th>
					<th>Thu</th><th>Fri</th><th>Sat</th>
					<th>Sun</th>
				</tr>
			</thead>
			<tbody>
				<tr>
					<td class="padding" colspan="3"></td>
					
					%{boolean f = false;}%
			%{ f = false;}%
					#{if ItemsDate.get(1).size() > 0}
				<td class="date_has_event">
						1
						<div class="events">
								<ul>
									#{list items:ItemsDate.get(1), as:'b'}
									<li>
									<span class="title">Item ${b_index}</span>
									<span class="desc">${b.getName()}.</span>
									<span class="desc">${b.getContent()}.</span>
									
									<br>
									</li>
									#{/list}
								</ul>
								
							%{f = true;}%
						</div>
					</td>
					#{/if}
					#{else}
					%{ if( f == false)}%
					<td>1</td>
					#{/else}	
					
					
					
	<!-- ###############################Day 2########################--> 				
					
					
					
					%{ f = false;}%
					#{if ItemsDate.get(2).size() > 0}
				<td class="date_has_event">
						2
						<div class="events">
								<ul>
									#{list items:ItemsDate.get(2), as:'b'}
									<li>
									<span class="title">Item ${b_index}</span>
									<span class="desc">${b.getName()}.</span>
									<span class="desc">${b.getContent()}.</span>
									<br>
									</li>
									#{/list}
								</ul>
								
							%{f = true;}%
						</div>
					</td>
					#{/if}
					#{else}
					%{ if( f == false)}%
					<td>2</td>
					#{/else}	
			
			
	<!-- ###############################Day 3########################--> 				
			
			
			
		%{ f = false;}%
					#{if ItemsDate.get(3).size() > 0}
				<td class="date_has_event">
						3
						<div class="events">
								<ul>
									#{list items:ItemsDate.get(3), as:'b'}
									<li>
									<span class="title">Item ${b_index}</span>
									<span class="desc">${b.getName()}.</span>
									<span class="desc">${b.getContent()}.</span>
									<br>
									</li>
									#{/list}
								</ul>
								
							%{f = true;}%
						</div>
					</td>
					#{/if}
					#{else}
					%{ if( f == false)}%
					<td>3</td>
					#{/else}	
					
					
					
	<!-- ###############################Day 4########################--> 				
			
			
			
		%{ f = false;}%
					#{if ItemsDate.get(4).size() > 0}
				<td class="date_has_event">
						4
						<div class="events">
								<ul>
									#{list items:ItemsDate.get(4), as:'b'}
									<li>
									<span class="title">Item ${b_index}</span>
									<span class="desc">${b.getName()}.</span>
									<span class="desc">${b.getContent()}.</span>
									<br>
									</li>
									#{/list}
								</ul>
								
							%{f = true;}%
						</div>
					</td>
					#{/if}
					#{else}
					%{ if( f == false)}%
					<td>4</td>
					#{/else}	
					
	
				</tr>
				
				<!-- ###############################Day 5########################--> 				
			
			<tr>
			
		%{ f = false;}%
					#{if ItemsDate.get(5).size() > 0}
				<td class="date_has_event">
						5
						<div class="events">
								<ul>
									#{list items:ItemsDate.get(5), as:'b'}
									<li>
									<span class="title">Item ${b_index}</span>
									<span class="desc">${b.getName()}.</span>
									<span class="desc">${b.getContent()}.</span>
									<br>
									</li>
									#{/list}
								</ul>
								
							%{f = true;}%
						</div>
					</td>
					#{/if}
					#{else}
					%{ if( f == false)}%
					<td>5</td>
					#{/else}	
					
		<!-- ###############################Day 6########################--> 				
			
			
			
		%{ f = false;}%
					#{if ItemsDate.get(6).size() > 0}
				<td class="date_has_event">
						6
						<div class="events">
								<ul>
									#{list items:ItemsDate.get(6), as:'b'}
									<li>
									<span class="title">Item ${b_index}</span>
									<span class="desc">${b.getName()}.</span>
									<span class="desc">${b.getContent()}.</span>
									<br>
									</li>
									#{/list}
								</ul>
								
							%{f = true;}%
						</div>
					</td>
					#{/if}
					#{else}
					%{ if( f == false)}%
					<td>6</td>
					#{/else}	
					
		<!-- ###############################Day 7########################--> 				
				
				
				%{ f = false;}%
					#{if ItemsDate.get(7).size() > 0}
				<td class="date_has_event">
						7
						<div class="events">
								<ul>
									#{list items:ItemsDate.get(7), as:'b'}
									<li>
									<span class="title">Item ${b_index}</span>
									<span class="desc">${b.getName()}.</span>
									<span class="desc">${b.getContent()}.</span>
									<br>
									</li>
									#{/list}
								</ul>
								
							%{f = true;}%
						</div>
					</td>
					#{/if}
					#{else}
					%{ if( f == false)}%
					<td>7</td>
					#{/else}	
					
					
<!-- ###############################Day 8########################--> 				
				
				
					%{ f = false;}%
					#{if ItemsDate.get(8).size() > 0}
				<td class="date_has_event">
						8
						<div class="events">
								<ul>
									#{list items:ItemsDate.get(8), as:'b'}
									<li>
									<span class="title">Item ${b_index}</span>
									<span class="desc">${b.getName()}.</span>
									<span class="desc">${b.getContent()}.</span>
									<br>
									</li>
									#{/list}
								</ul>
								
							%{f = true;}%
						</div>
					</td>
					#{/if}
					#{else}
					%{ if( f == false)}%
					<td>8</td>
					#{/else}	
<!-- ###############################Day 9########################--> 				
				
				%{ f = false;}%
					#{if ItemsDate.get(9).size() > 0}
				<td class="date_has_event">
						9
						<div class="events">
								<ul>
									#{list items:ItemsDate.get(9), as:'b'}
									<li>
									<span class="title">Item ${b_index}</span>
									<span class="desc">${b.getName()}.</span>
									<span class="desc">${b.getContent()}.</span>
									<br>
									</li>
									#{/list}
								</ul>
								
							%{f = true;}%
						</div>
					</td>
					#{/if}
					#{else}
					%{ if( f == false)}%
					<td>9</td>
					#{/else}	
<!-- ###############################Day 10########################--> 				
				
				%{ f = false;}%
					#{if ItemsDate.get(10).size() > 0}
				<td class="date_has_event">
						10
						<div class="events">
								<ul>
									#{list items:ItemsDate.get(10), as:'b'}
									<li>
									<span class="title">Item ${b_index}</span>
									<span class="desc">${b.getName()}.</span>
									<span class="desc">${b.getContent()}.</span>
									<br>
									</li>
									#{/list}
								</ul>
								
							%{f = true;}%
						</div>
					</td>
					#{/if}
					#{else}
					%{ if( f == false)}%
					<td>10</td>
					#{/else}	
<!-- ###############################Day 11########################--> 				
		%{ f = false;}%
					#{if ItemsDate.get(11).size() > 0}
				<td class="date_has_event">
						11
						<div class="events">
								<ul>
									#{list items:ItemsDate.get(11), as:'b'}
									<li>
									<span class="title">Item ${b_index}</span>
									<span class="desc">${b.getName()}.</span>
									<span class="desc">${b.getContent()}.</span>
									<br>
									</li>
									#{/list}
								</ul>
								
							%{f = true;}%
						</div>
					</td>
					#{/if}
					#{else}
					%{ if( f == false)}%
					<td>11</td>
					#{/else}	
				</tr>
				
<!-- ###############################Day 12########################--> 				
				<tr>
				
				%{ f = false;}%
					#{if ItemsDate.get(12).size() > 0}
				<td class="date_has_event">
						12
						<div class="events">
								<ul>
									#{list items:ItemsDate.get(12), as:'b'}
									<li>
									<span class="title">Item ${b_index}</span>
									<span class="desc">${b.getName()}.</span>
									<span class="desc">${b.getContent()}.</span>
									<br>
									</li>
									#{/list}
								</ul>
								
							%{f = true;}%
						</div>
					</td>
					#{/if}
					#{else}
					%{ if( f == false)}%
					<td>12</td>
					#{/else}	
<!-- ###############################Day 13########################--> 				
				
			%{ f = false;}%
					#{if ItemsDate.get(13).size() > 0}
				<td class="date_has_event">
						13
						<div class="events">
								<ul>
									#{list items:ItemsDate.get(13), as:'b'}
									<li>
									<span class="title">Item ${b_index}</span>
									<span class="desc">${b.getName()}.</span>
									<span class="desc">${b.getContent()}.</span>
									<br>
									</li>
									#{/list}
								</ul>
								
							%{f = true;}%
						</div>
					</td>
					#{/if}
					#{else}
					%{ if( f == false)}%
					<td>13</td>
					#{/else}	
<!-- ###############################Day 14########################--> 				
			%{ f = false;}%
					#{if ItemsDate.get(14).size() > 0}
				<td class="date_has_event">
						14
						<div class="events">
								<ul>
									#{list items:ItemsDate.get(14), as:'b'}
									<li>
									<span class="title">Item ${b_index}</span>
									<span class="desc">${b.getName()}.</span>
									<span class="desc">${b.getContent()}.</span>
									<br>
									</li>
									#{/list}
								</ul>
								
							%{f = true;}%
						</div>
					</td>
					#{/if}
					#{else}
					%{ if( f == false)}%
					<td>14</td>
					#{/else}	
<!-- ###############################Day 15########################--> 				
				
				
				%{ f = false;}%
					#{if ItemsDate.get(15).size() > 0}
				<td class="date_has_event">
						15
						<div class="events">
								<ul>
									#{list items:ItemsDate.get(15), as:'b'}
									<li>
									<span class="title">Item ${b_index}</span>
									<span class="desc">${b.getName()}.</span>
									<br>
									</li>
									#{/list}
								</ul>
								
							%{f = true;}%
						</div>
					</td>
					#{/if}
					#{else}
					%{ if( f == false)}%
					<td>15</td>
					#{/else}	
					
					
<!-- ###############################Day 16########################--> 				
				
				
				%{ f = false;}%
					#{if ItemsDate.get(16).size() > 0}
				<td class="date_has_event">
						16
						<div class="events">
								<ul>
									#{list items:ItemsDate.get(16), as:'b'}
									<li>
									<span class="title">Item ${b_index}</span>
									<span class="desc">${b.getName()}.</span>
									<br>
									</li>
									#{/list}
								</ul>
								
							%{f = true;}%
						</div>
					</td>
					#{/if}
					#{else}
					%{ if( f == false)}%
					<td>16</td>
					#{/else}
					
<!-- ###############################Day 17########################--> 				
				
			%{ f = false;}%
					#{if ItemsDate.get(17).size() > 0}
				<td class="date_has_event">
						17
						<div class="events">
								<ul>
									#{list items:ItemsDate.get(17), as:'b'}
									<li>
									<span class="title">Item ${b_index}</span>
									<span class="desc">${b.getName()}.</span>
									<br>
									</li>
									#{/list}
								</ul>
								
							%{f = true;}%
						</div>
					</td>
					#{/if}
					#{else}
					%{ if( f == false)}%
					<td>17</td>
					#{/else}	
					
<!-- ###############################Day 18########################--> 				
				
			%{ f = false;}%
					#{if ItemsDate.get(18).size() > 0}
				<td class="date_has_event">
						18
						<div class="events">
								<ul>
									#{list items:ItemsDate.get(18), as:'b'}
									<li>
									<span class="title">Item ${b_index}</span>
									<span class="desc">${b.getName()}.</span>
									<span class="desc">${b.getContent()}.</span>
									<br>
									</li>
									#{/list}
								</ul>
								
							%{f = true;}%
						</div>
					</td>
					#{/if}
					#{else}
					%{ if( f == false)}%
					<td>18</td>
					#{/else}	
					
					</tr>
					
				<tr>
<!-- ###############################Day 19########################--> 				
				
			%{ f = false;}%
					#{if ItemsDate.get(19).size() > 0}
				<td class="date_has_event">
						19
						<div class="events">
								<ul>
									#{list items:ItemsDate.get(19), as:'b'}
									<li>
									<span class="title">Item ${b_index}</span>
									<span class="desc">${b.getName()}.</span>
									<span class="desc">${b.getContent()}.</span>
									<br>
									</li>
									#{/list}
								</ul>
								
							%{f = true;}%
						</div>
					</td>
					#{/if}
					#{else}
					%{ if( f == false)}%
					<td>19</td>
					#{/else}	
					
<!-- ###############################Day 20########################--> 				
				
			%{ f = false;}%
					#{if ItemsDate.get(20).size() > 0}
				<td class="date_has_event">
						20
						<div class="events">
								<ul>
									#{list items:ItemsDate.get(20), as:'b'}
									<li>
									<span class="title">Item ${b_index}</span>
									<span class="desc">${b.getName()}.</span>
									<span class="desc">${b.getContent()}.</span>
									<br>
									</li>
									#{/list}
								</ul>
								
							%{f = true;}%
						</div>
					</td>
					#{/if}
					#{else}
					%{ if( f == false)}%
					<td>20</td>
					#{/else}	
					
<!-- ###############################Day 21########################--> 				
				
			%{ f = false;}%
					#{if ItemsDate.get(13).size() > 0}
				<td class="date_has_event">
						21
						<div class="events">
								<ul>
									#{list items:ItemsDate.get(21), as:'b'}
									<li>
									<span class="title">Item ${b_index}</span>
									<span class="desc">${b.getName()}.</span>
									<span class="desc">${b.getContent()}.</span>
									<br>
									</li>
									#{/list}
								</ul>
								
							%{f = true;}%
						</div>
					</td>
					#{/if}
					#{else}
					%{ if( f == false)}%
					<td>21</td>
					#{/else}
<!-- ###############################Day 22########################--> 				
				
			%{ f = false;}%
					#{if ItemsDate.get(22).size() > 0}
				<td class="date_has_event">
						22
						<div class="events">
								<ul>
									#{list items:ItemsDate.get(22), as:'b'}
									<li>
									<span class="title">Item ${b_index}</span>
									<span class="desc">${b.getName()}.</span>
									<br>
									</li>
									#{/list}
								</ul>
								
							%{f = true;}%
						</div>
					</td>
					#{/if}
					#{else}
					%{ if( f == false)}%
					<td>22</td>
					#{/else}	
					
<!-- ###############################Day 23########################--> 				
				
			%{ f = false;}%
					#{if ItemsDate.get(23).size() > 0}
				<td class="date_has_event">
						13
						<div class="events">
								<ul>
									#{list items:ItemsDate.get(23), as:'b'}
									<li>
									<span class="title">Item ${b_index}</span>
									<span class="desc">${b.getName()}.</span>
									<br>
									</li>
									#{/list}
								</ul>
								
							%{f = true;}%
						</div>
					</td>
					#{/if}
					#{else}
					%{ if( f == false)}%
					<td>23</td>
					#{/else}	
<!-- ###############################Day 24########################--> 				
				
			%{ f = false;}%
					#{if ItemsDate.get(24).size() > 0}
				<td class="date_has_event">
						24
						<div class="events">
								<ul>
									#{list items:ItemsDate.get(24), as:'b'}
									<li>
									<span class="title">Item ${b_index}</span>
									<span class="desc">${b.getName()}.</span>
									<br>
									</li>
									#{/list}
								</ul>
								
							%{f = true;}%
						</div>
					</td>
					#{/if}
					#{else}
					%{ if( f == false)}%
					<td>24</td>
					#{/else}	
					
<!-- ###############################Day 25########################--> 				
				
			%{ f = false;}%
					#{if ItemsDate.get(25).size() > 0}
				<td class="date_has_event">
						25
						<div class="events">
								<ul>
									#{list items:ItemsDate.get(25), as:'b'}
									<li>
									<span class="title">Item ${b_index}</span>
									<span class="desc">${b.getName()}.</span>
									<br>
									</li>
									#{/list}
								</ul>
								
							%{f = true;}%
						</div>
					</td>
					#{/if}
					#{else}
					%{ if( f == false)}%
					<td>25</td>
					#{/else}	
					
					</tr>	
				<tr>
<!-- ###############################Day 26########################--> 				
				
			%{ f = false;}%
					#{if ItemsDate.get(26).size() > 0}
				<td class="date_has_event">
						26
						<div class="events">
								<ul>
									#{list items:ItemsDate.get(26), as:'b'}
									<li>
									<span class="title">Item ${b_index}</span>
									<span class="desc">${b.getName()}.</span>
									<span class="desc">${b.getContent()}.</span>
									<br>
									</li>
									#{/list}
								</ul>
								
							%{f = true;}%
						</div>
					</td>
					#{/if}
					#{else}
					%{ if( f == false)}%
					<td>26</td>
					#{/else}	
					
										
<!-- ###############################Day 27########################--> 				
				
			%{ f = false;}%
					#{if ItemsDate.get(27).size() > 0}
				<td class="date_has_event">
						27
						<div class="events">
								<ul>
									#{list items:ItemsDate.get(27), as:'b'}
									<li>
									<span class="title">Item ${b_index}</span>
									<span class="desc">${b.getName()}.</span>
									<span class="desc">${b.getContent()}.</span>
									<br>
									</li>
									#{/list}
								</ul>
								
							%{f = true;}%
						</div>
					</td>
					#{/if}
					#{else}
					%{ if( f == false)}%
					<td>27</td>
					#{/else}	
					
<!-- ###############################Day 28########################--> 				
				
			%{ f = false;}%
					#{if ItemsDate.get(28).size() > 0}
				<td class="date_has_event">
						28
						<div class="events">
								<ul>
									#{list items:ItemsDate.get(28), as:'b'}
									<li>
									<span class="title">Item ${b_index}</span>
									<span class="desc">${b.getName()}.</span>
									<br>
									</li>
									#{/list}
								</ul>
								
							%{f = true;}%
						</div>
					</td>
					#{/if}
					#{else}
					%{ if( f == false)}%
					<td>28</td>
					#{/else}	
					
<!-- ###############################Day 29########################--> 				
				
			%{ f = false;}%
					#{if ItemsDate.get(29).size() > 0}
				<td class="date_has_event">
						29
						<div class="events">
								<ul>
									#{list items:ItemsDate.get(29), as:'b'}
									<li>
									<span class="title">Item ${b_index}</span>
									<span class="desc">${b.getName()}.</span>
									<span class="desc">${b.getContent()}.</span>
									<br>
									</li>
									#{/list}
								</ul>
								
							%{f = true;}%
						</div>
					</td>
					#{/if}
					#{else}
					%{ if( f == false)}%
					<td>29</td>
					#{/else}	
<!-- ###############################Day 30########################--> 				
				
			%{ f = false;}%
					#{if ItemsDate.get(30).size() > 0}
				<td class="date_has_event">
						30
						<div class="events">
								<ul>
									#{list items:ItemsDate.get(30), as:'b'}
									<li>
									<span class="title">Item ${b_index}</span>
									<span class="desc">${b.getName()}.</span>
									<span class="desc">${b.getContent()}.</span>
									<br>
									</li>
									#{/list}
								</ul>
								
							%{f = true;}%
						</div>
					</td>
					#{/if}
					#{else}
					%{ if( f == false)}%
					<td>30</td>
					#{/else}	
<!-- ###############################Day 31########################--> 				
				
			%{ f = false;}%
					#{if ItemsDate.get(31).size() > 0}
				<td class="date_has_event">
						31
						<div class="events">
								<ul>
									#{list items:ItemsDate.get(31), as:'b'}
									<li>
									<span class="title">Item ${b_index}</span>
									<span class="desc">${b.getName()}.</span>
									<span class="desc">${b.getContent()}.</span>
									<br>
									</li>
									#{/list}
								</ul>
								
							%{f = true;}%
						</div>
					</td>
					#{/if}
					#{else}
					%{ if( f == false)}%
					<td>31</td>
					#{/else}	
										
					<td class="padding"></td>
				</tr>
			</tbody>
			<tfoot>
				<th>Mon</th><th>Tue</th><th>Wed</th>
				<th>Thu</th><th>Fri</th><th>Sat</th>
				<th>Sun</th>
			</tfoot>
		</table>
		#{/if}
		#{else}
		#{if id == 0}
		<h1> No items to be displayed </h1>
		#{/if}
		#{else}
		<h1> End of Calendar </h1>
		<h4> <a href="@{Plans.createCalendar()}?id=${PId}&planId=${planId}"  >previous month </a> </h4>
		#{/else}
		#{/else}
	</body>
</html>